﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ControlAccessUser.Presenter;

namespace ControlAccessUser.Presentation
{
    /// <summary>
    /// Lógica de interacción para ViewUserLogins.xaml
    /// </summary>
    public partial class ReportsOfLogins : Window, IReportsOfLoginsView
    {
        Model.User User;
        PresenterReportsOfLogins pReportsOfLogins;
        public ReportsOfLogins(Model.User User)
        {
            InitializeComponent();
            this.User = User;
            pReportsOfLogins = new PresenterReportsOfLogins(this);

        }
        #region
        Model.User IReportsOfLoginsView.User
        {
            get
            {
                return User;
            }
            set
            { }
        }

        public string FilterType
        {
            get 
            {
                if (string.IsNullOrEmpty(cbxTypeOfFilter.Text))
                {
                    return "SESION";
                }
                else
                    return cbxTypeOfFilter.Text;
            }
            set
            {

            }
        }

        public DateTime DateTimeInit
        {
            get
            {
                if (datePickerDateInit.SelectedDate != null)
                {
                    return (DateTime)datePickerDateInit.SelectedDate;
                }
                else
                    return DateTime.Now.AddYears(-5);                
            }
            set
            {
 
            }
        }

        public DateTime DateTimeEnd
        {
            get
            {
                if (datePickerDateEnd.SelectedDate!=null)
                {
                    return (DateTime)datePickerDateEnd.SelectedDate;
                }
                else
                    return DateTime.Now.AddDays(1);                
            }
            set
            {

            }
        }

        public ICollection<Model.ItemReport> Logins
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                dataGridReportsOfLogins.ItemsSource = value;
            }
        }
        #endregion

        private void btnFilter_Click(object sender, RoutedEventArgs e)
        {
            pReportsOfLogins.SearchLoginsByUser();
        }

    }
}
